n=6
r=3
arr=list(range(1,n+1))
print(arr)
x=r-1
while len(arr)>1:
    print(x)
    arr.pop(x)
    if (x >= len(arr)):
        x = 0
    for i in range(r-1):
        x+=1
        if(x>=len(arr)):
            x=0
    print(arr)
print(arr)